//获取学生页面数据 并完成渲染
async function getstudenthtml() { 
    const res = await axios.get('/students')  //await的作用是 等待异步操作完成
    console.log(res)  // res.data是服务器返回的数据
    // 渲染页面
    const html = res.data.map(item => {
        const{age,area,city,createdAt,gender,group,hope_salary,id,name,province,salary,updatedAt,user_id}=item
return`
<tr>
                      <td>${name}</td>
                      <td>${age}</td>
                      <td>${gender}</td>
                      <td>第${group}组</td>
                      <td>${hope_salary}</td>
                      <td>${salary}</td>
                      <td>${province+city+area}</td>
                      <td data-id="${id}">
                        <a href="javascript:;" class="text-success mr-3"><i class="bi bi-pen"></i></a>
                        <a href="javascript:;" class="text-danger"><i class="bi bi-trash"></i></a>
                      </td>
                    </tr>
`


    }).join('')

    document.querySelector('.list').innerHTML = html
    document.querySelector('.total').innerText = res.data.length

}
getstudenthtml()  